//20220419继续修改
document.getElementById('href').innerHTML = "您当前访问的URL是：" + location.href;
//执行HTTP操作的方法之一 ，type = get | put | post | delete
function doHttp(type, url, data){
	var r = '';
	$.ajax({
		type : type,
		url : url,
		async : false,
		contentType : "application/json;charset=utf-8",
		data : data,
		success : function(data) {
			r = data;
		},
		error : function(e) {
			alert(JSON.stringify(e));
		}
	});
	return r;
}
//form序列化为json
$.fn.serializeObject = function() {
	var o = {};
	var a = this.serializeArray();
	$.each(a, function() {
		if (o[this.name] !== undefined) {
			if (!o[this.name].push) {
				o[this.name] = [o[this.name]];
			}
			o[this.name].push(this.value || '');
		} else {
			o[this.name] = this.value || '';
		}
	});
	return o;
};

//执行HTTP操作的方法之二
//提交表单
function quickSave(url, type, data, funSucc, funFail) {
	if (confirm('是否执行操作？')) {
		$.ajax({
			type : type,
			url : url,
			data : JSON.stringify(data),
			contentType : "application/json;charset=utf-8",
			success : function(data) {
				alert(data.message);
				if (data.success) {
					var f = eval(funSucc);
					new f();
				} else {
					var f = eval(funFail);
					new f();
				}
			},
			error : function(e) {
				alert(JSON.stringify(e));
			}
		});
	}
}
